#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1;
const int M = 1e9+7;

map<int, string> m;
string s1, s2, s3, t;

int main()
{
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> s1 >> s2 >> s3 >> t;
    m[1] = s1, m[2] = s2, m[3] = s3;

    for (auto ch : t) {
        cout << m[ch-'0'];
    }
    cout << endl;
    return 0;
}